package ru.compscicenter.uno.view;

import ru.compscicenter.uno.model.IModel;

import javax.swing.*;

/**
 * Created by IntelliJ IDEA.
 * User: Павел
 * Date: 26.11.11
 * Time: 0:56
 * To change this template use File | Settings | File Templates.
 */
public class GameFrame extends JFrame {
    private final GamePanel gamePanel;

    public GameFrame(IModel model, boolean isServer) {
        super();
        gamePanel = new GamePanel(model, isServer);
        gamePanel.setFocusable(true);

        //Schedule a job for the event-dispatching thread:
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                initUI();
            }
        });
    }

    private void initUI() {
        setSize(800, 600);

        gamePanel.setBounds(0, 0, getWidth(), getHeight());
        add(gamePanel, null);
        setContentPane(gamePanel);
        this.setTitle("Uno");
    }

    public GamePanel getGamePanel() {
        return gamePanel;
    }
}
